export function empListColumns() {
  const vm = this;
  const COLUMN_WIDTH = window.RPConfig.COLUMN_WIDTH
  console.log(COLUMN_WIDTH,"COLUMN_WIDTH")
  return [
    // {
    //   type: "selection",
    //   width: 40,
    //   align: "left"
    // },
    {
      title: vm.$t("module.employee.employeeNo"),
      sortable: "custom",
      minWidth: 120,
      key: "employeeNo"
    },
    {
      title: vm.$t("module.employee.name"),
      sortable: "custom",
      minWidth: 120,
      key: "name"
    },
    {
      title: vm.$t("module.employee.sex"),
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_2_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_2_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,

      render: (h, p) =>
        h("span", p.row.sex === "F" ? vm.$t("common.woman") : p.row.sex === "M" ? vm.$t("common.man") : "")
    },
    // {
    //   title: this.$t("module.employee.deparmentPosition"),
    //   key: "userRepository",
    //   minWidth: 300,
    //   render: (h, params) => {
    //     return h(
    //       "span",
    //       {
    //         attrs: {
    //           title: (params.row.deptOrgName || []).join("；")
    //         }
    //       },
    //       (params.row.deptOrgName || []).join("；")
    //     );
    //   }
    // },
    {
      title: vm.$t("module.employee.officePhone"),
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_8_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_8_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,
      key: "officePhone"
    },
    {
      title: vm.$t("module.employee.mobile"),
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_MOBILE,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_MOBILE + COLUMN_WIDTH.MAX_WIDTH_MORE,
      key: "mobile"
    },
    {
      title: vm.$t("module.employee.email"),
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_EMAIL,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_EMAIL + COLUMN_WIDTH.MAX_WIDTH_MORE,
      key: "email"
    },
    {
      title: this.$t("common.status"),
      key: "enabled",
      align: "center",
      minWidth: 80,
      maxWidth: 80 + COLUMN_WIDTH.MAX_WIDTH_MORE,

      render: (h, params) => {
        return h(
          "StatusButton",
          {
            // 修改StatusButton内容居中
            style: {
              "justify-content": "center"
            },

            props: {
              status: params.row.status == 0 ? "0" : "1"
            }
          },
          params.row.status == 0 ? this.$t("module.employee.incumbent") : this.$t("module.employee.dimission")
        );
      }
    },
    {
      title: vm.$t("common.operating"),
      align: "left",
      fixed: "right",
      width: 100,
      render: (h, { row }) => {
        return h("RowTools", {
          props: {
            data: [
              {
                type: "icon",
                icon: "md-create",
                text: vm.$t("module.employee.editEmpInfo"),
                handle: () => vm.catEmpDetail(row.employeeNo, true)
              },
              {
                type: "icon",
                icon: "md-medkit",
                text: vm.$t("module.employee.catHang"),
                handle: () => vm.catHang(row)
              }
              // {
              //   type: "icon",
              //   icon: "ios-trash",
              //   hidden: (row.deptOrgName || []).length !== 0,
              //   text: vm.$t("module.employee.catDetail"),
              //   handle: () => vm.deletComform([row.id])
              // }
            ]
          }
        });
      }
    }
  ];
}

export function selectEmpListColumns() {
  const vm = this;
  return [
    {
      title: vm.$t("module.employee.employeeNo"),
      sortable: "custom",
      minWidth: 120,
      key: "employeeNo"
    },
    {
      title: vm.$t("module.employee.name"),
      sortable: "custom",
      minWidth: 120,
      key: "name"
    },
    {
      title: this.$t("module.employee.deparmentPosition"),
      key: "userRepository",
      minWidth: 300,
      render: (h, params) => {
        return h(
          "span",
          {
            attrs: {
              title: (params.row.deptOrgName || []).join("；")
            }
          },
          (params.row.deptOrgName || []).join("；")
        );
      }
    },
    {
      title: this.$t("common.status"),
      align: "left",
      key: "enabled",
      width: 100,
      render: (h, params) => {
        return h(
          "StatusButton",
          {
            props: {
              status: params.row.status == 0 ? "0" : "1"
            }
          },
          params.row.status == 0 ? this.$t("module.employee.incumbent") : this.$t("module.employee.dimission")
        );
      }
    }
  ];
}

export function jobColmns() {
  const vm = this;
  const COLUMN_WIDTH = window.RPConfig.COLUMN_WIDTH
  return [
    {
      type: "selection",
      width: 50,
      align: "left"
    },
    {
      title: vm.$t("module.employee.company"),
      key: "costCenterName",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_EMAIL
    },
    {
      title: vm.$t("module.employee.departmentDesc"),
      key: "departmentName",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_EMAIL
    },
    {
      title: vm.$t("module.employee.workplace"),
      key: "description",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_EMAIL
    },
    {
      title: vm.$t("module.employee.positionDesc"),
      key: "positionName",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDDHHMM
    },
    {
      title: vm.$t("module.employee.positionCode"),
      key: "positionCode"
    },

    {
      title: vm.$t("module.employee.jobCodeDesc"),
      key: "jobName"
    },
    {
      title: vm.$t("module.employee.jobCode"),
      key: "jobCode",
      width: 70
    },
    {
      title: vm.$t("module.employee.mainPostFlag"),
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_3_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_3_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,

      render: (h, { row }) => h("span", row.mainPostFlag == "Y" ? vm.$t("common.mainjob") : vm.$t("common.partjob"))
    },
    {
      title: vm.$t("module.employee.supervisorName"),
      key: "supervisorName"
    },
    {
      title: vm.$t("module.employee.supervisorEmployeeNo"),
      key: "supervisorEmployeeNo"
    },
    {
      title: vm.$t("module.employee.startTime"),
      key: "startTime",
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDDHHMMSS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDDHHMMSS + COLUMN_WIDTH.MAX_WIDTH_MORE,
    },
    {
      title: vm.$t("module.employee.endTime"),
      key: "endTime",
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDDHHMMSS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDDHHMMSS + COLUMN_WIDTH.MAX_WIDTH_MORE,
    },
    {
      title: `${vm.$t("module.employee.enabled")}`,
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_4_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_4_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,
      render: (h, p) => {
        return h(
          "StatusButton",
          {
            // 修改StatusButton内容居中
            style: {
              "justify-content": "center"
            },

            props: {
              status: p.row.enabled == 1 ? "0" : "1"
            }
          },
          p.row.enabled == 1 ? vm.$t("common.enable") : vm.$t("common.disable")
        );
      }
    },
    {
      title: vm.$t("common.operating"),
      align: "left",
      fixed: "right",
      width: 80,
      render: (h, { row }) => {
        return h("RowTools", {
          props: {
            data: [
              // {
              //   type: "icon",
              //   icon: "md-create",
              //   text: vm.$t("common.edit"),
              //   handle: () => vm.catEmpDetail(row.id,"edit", true)
              // },
              {
                type: "icon",
                icon: "ios-eye",
                text: vm.$t("module.employee.catDetail"),
                handle: () => vm.catEmpDetail(row,"look")
              }
            ]
          }
        });
      }
    }
  ];
}
